<template>
  <div class="searchResult">
    <van-nav-bar
      class="dh"
      left-text="搜索"
      right-text="..."
      left-arrow
      @click-left="$router.go(-1)"
    />
    <div class="find">
      <input type="text" placeholder="搜索商家、商品名称" />
      <span>搜索</span>
    </div>
    <div class="px">
      <span v-for="(item, index) in pxArr" :key="index">{{ item }}</span>
    </div>
    <div class="rm">
      <span v-for="(item, index) in rmArr" :key="index">{{ item }}</span>
    </div>
    <div class="shop" v-for="(item, index) in searchList" :key="index">
      <div class="img">
        <img :src="item.picUrl" alt="" />
      </div>
      <div class="dr">
        <div class="name">
          <span>{{ item.name }}</span>
        </div>
        <div class="xs">
          <span>{{ item.wmPoiScore / 10 }}</span>
          <span>{{ item.monthSalesTip }}</span>
        </div>
        <div class="ps">
          <span>{{ item.minPriceTip }}</span>
          <span>{{ item.shippingFeeTip }}</span>
          <span>{{ item.deliveryTimeTip }}</span>
          <span>{{ item.distance }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { shop_search } from "../../utils/api";
export default {
  data() {
    return {
      pxArr: ["综合排序", "距离最近", "销量最高", "筛选"],
      rmArr: ["年货节热卖", "津贴联盟", "满减优惠", "品质联盟"],
      searchList: [],
    };
  },
  mounted() {
    shop_search({ searchkey: "米线" }).then((res) => {
      //   console.log(res.data);
      this.searchList = res.data.list;
      // console.log(this.searchList);
    });
  },
};
</script>

<style lang='scss' scoped>
.searchResult {
  .find {
    padding: 10px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    input {
      height: 40px;
      outline: none;
      width: 100%;
      border: none;
      background: #f5f5f5;
      border-radius: 20px;
      padding-left: 30px;
    }
    span {
      width: 70px;
      text-align: center;
      color: blue;
    }
  }
  .px {
    padding: 0 10px;
    display: flex;
    justify-content: space-between;
  }
  .rm {
    padding: 0 10px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    span {
      background: #f5f5f5;
      padding: 10px;
      font-size: 14px;
      border-radius: 5px;
    }
  }
  .shop {
    padding: 10px;
    display: flex;
    .img {
      width: 100px;
      margin-right: 10px;
      img {
        width: 100%;
      }
    }
    .dr {
      .name span {
        font-weight: bold;
      }
      .xs {
        margin-top: 5px;
        span {
          margin-right: 10px;
        }
      }
      .ps {
        margin-top: 5px;
        span {
          margin-right: 5px;
        }
      }
    }
  }
}
</style>